//
//  YDWithdrawalTableFooterView.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2017/11/14.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDWithdrawalTableFooterView.h"

@interface YDWithdrawalTableFooterView()

@property (nonatomic , weak) UIView *addBankBackView;
@property (nonatomic , weak) UIImageView *addBnakImage;
//温馨提示
@property (nonatomic , weak) UILabel *postLabel;

//内容
@property (nonatomic , weak) UILabel *detailLabel;
@end



@implementation YDWithdrawalTableFooterView


+ (instancetype)footerViewWithTableView:(UITableView *)tableView
{
    
    static NSString *withdrawalTableFooterView = @"YDWithdrawalTableFooterView";
    YDWithdrawalTableFooterView *footerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:withdrawalTableFooterView];
    if (footerView == nil) {
        footerView = [[YDWithdrawalTableFooterView alloc] initWithReuseIdentifier:withdrawalTableFooterView];
    }
    return footerView;
}


-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor clearColor];
        
        [self addBankBackView];
        [self addBnakImage];
        
//        [self postLabel];
//
//        [self detailLabel];
        
    }
    return self;
}

-(UIView *)addBankBackView
{
    if (_addBankBackView == nil) {
        UIView *addBankBackView = [[UIView alloc] init];
        [self.contentView addSubview:addBankBackView];
        addBankBackView.userInteractionEnabled = YES;
        addBankBackView.backgroundColor = [UIColor clearColor];
        
        [addBankBackView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.left.right.equalTo(self);
            if (isPhoneX) {
                make.height.equalTo(@(rateX812(25)));
                make.top.equalTo(self).offset(rateX812(10));
            }else{
                make.height.equalTo(@(rate750(25)));
                make.top.equalTo(self).offset(rate750(10));
            }
            
        }];
        
        _addBankBackView = addBankBackView;
    }
    return _addBankBackView;
}
//mine-tianjia
-(UIImageView *)addBnakImage
{
    if (_addBnakImage == nil) {
        UIImageView *addBnakImage = [[UIImageView alloc] init];
        [self.addBankBackView addSubview:addBnakImage];
        addBnakImage.image = [UIImage imageNamed:@"mine-tianjia"];
        [addBnakImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self.addBankBackView);
        }];
        addBnakImage.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick)];
        [addBnakImage addGestureRecognizer:tap];
        _addBnakImage = addBnakImage;
    }
    return _addBnakImage;
}
-(void)tapClick
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(withdrawalTableFooterViewDidClickAddButton:)]) {
        [self.delegate withdrawalTableFooterViewDidClickAddButton:self];
    }
}
-(UILabel *)postLabel
{
    if (_postLabel == nil) {
        UILabel *postLabel = [[UILabel alloc] init];
        [self.contentView addSubview:postLabel];//blueyGrey
        postLabel.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        postLabel.textColor = [UIColor colorWithHexString:blueyGrey];
        postLabel.textAlignment = NSTextAlignmentLeft;
        postLabel.text = @"温馨提示";
        [postLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(rate375(20));
            if (isPhoneX) {
                make.top.equalTo(self.addBankBackView.mas_bottom).offset(rateX812(10));
            }else{
                make.top.equalTo(self.addBankBackView.mas_bottom).offset(rate750(10));
            }
        }];
        _postLabel = postLabel;
    }
    return _postLabel;
}

-(UILabel *)detailLabel
{
    if (_detailLabel == nil) {
        UILabel *detailLabel = [[UILabel alloc] init];
        [self.contentView addSubview:detailLabel];//blueyGrey
        detailLabel.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        detailLabel.textColor = [UIColor colorWithHexString:Orange];
        detailLabel.textAlignment = NSTextAlignmentLeft;
        detailLabel.numberOfLines = 0;
        [detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.postLabel);
            make.right.equalTo(self).offset(-rate375(20));
            if (isPhoneX) {
                make.top.equalTo(self.postLabel.mas_bottom).offset(rateX812(10));
            }else{
                make.top.equalTo(self.postLabel.mas_bottom).offset(rate750(10));
            }
        }];
        NSString *string = @"如有疑问请咨询客服0755-23065340";
        
        NSAttributedString *attr = [NSString createLineWrapAttriStringWithString:string andLineSpace:2.0 withWrapSpace:0.3 Font:[UIFont systemFontOfSize:font12ScreenWRate * LKScreenW]];
        
        detailLabel.attributedText = attr;
        
        _detailLabel = detailLabel;
    }
    return _detailLabel;
}



@end
